﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace Hangout.Client.Accounts
{
    public partial class Foursquare : PhoneApplicationPage
    {
        public Foursquare()
        {
            InitializeComponent();
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            FoursquareWB.Navigate(new Uri(@"https://foursquare.com/oauth2/authenticate?client_id=" + AppID.FoursquareAppID + "&response_type=token&redirect_uri=http://www.zoik.it&display=touch", UriKind.RelativeOrAbsolute));
        }

        private void FoursquareWB_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            if (e.Uri.ToString().Contains(@"access_token"))
            {
                FoursquareWB.Visibility = System.Windows.Visibility.Collapsed;
                PG.Visibility = System.Windows.Visibility.Visible;
                string accessToken = e.Uri.ToString().Split('=')[1]; //got the accesss token :)

                
                


               
            }
        }



    }
}